package router

import (
	"dog-blog/base/storage"
	"html/template"
)

// TmpFuncMap 模版函数
var TmpFuncMap = template.FuncMap{
	"formatUnix": formatUnix,
	"advert":     advert,
	"author":     func() string { return storage.GetBasic().Author },
	"slogan":     func() string { return storage.GetBasic().Slogan },
	"IPCode":     func() string { return storage.GetBasic().Icp },
	"rootURL":    func() string { return storage.GetBasic().RootURL },
}

func formatUnix(t string) string {
	return "2020:02:20 20:20:20"
}

func advert() string {
	return storage.GetBasic().Advert
}

// GetFuncMap 获取模版函数map
func GetFuncMap() template.FuncMap {
	return TmpFuncMap
}
